<?php
include("../includes/DBFunctions.php");
include("../includes/GXMLParser.php");

function displayRegionsFunctor() {
	$db = new DBFunctions;
	$db->connectDB();
	$result = $db->query("call displayRegions();");
	if( !$result ) {
		die("alert('Failed stored procedure call (displayRegions)');");
	}
	
	$xml = new GXMLParser;
	$xml->openXML();
	while( $line = mysqli_fetch_array( $result, MYSQL_ASSOC ) ) {
		$xml->addFlag( $line['Name'], $line['Latitude'], $line['Longitude'], $line['Region_ID']  );
	}
	$xml->closeXML("displayRegions");
	$db->closeDB();
}

displayRegionsFunctor();
?>